﻿namespace Nancy.Repository.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class wgb0001 : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.User",
                c => new
                    {
                        Id = c.Guid(nullable: false, identity: true),
                        LoginName = c.String(nullable: false),
                        Password = c.String(nullable: false),
                        UseState = c.Int(nullable: false),
                        UserInfoId = c.Guid(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.UserInfo", t => t.UserInfoId, cascadeDelete: true)
                .Index(t => t.UserInfoId);
            
            CreateTable(
                "dbo.UserInfo",
                c => new
                    {
                        Id = c.Guid(nullable: false, identity: true),
                        UserCode = c.String(),
                        UserName = c.String(),
                        Age = c.Int(),
                        Sex = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id);
            
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.User", "UserInfoId", "dbo.UserInfo");
            DropIndex("dbo.User", new[] { "UserInfoId" });
            DropTable("dbo.UserInfo");
            DropTable("dbo.User");
        }
    }
}
